import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/basic_information/on_duty_entity.dart';

OnDutyEntity $OnDutyEntityFromJson(Map<String, dynamic> json) {
  final OnDutyEntity onDutyEntity = OnDutyEntity();
  final int? askForLeave = jsonConvert.convert<int>(json['askForLeave']);
  if (askForLeave != null) {
    onDutyEntity.askForLeave = askForLeave;
  }
  final int? beLate = jsonConvert.convert<int>(json['beLate']);
  if (beLate != null) {
    onDutyEntity.beLate = beLate;
  }
  final int? leaveEarly = jsonConvert.convert<int>(json['leaveEarly']);
  if (leaveEarly != null) {
    onDutyEntity.leaveEarly = leaveEarly;
  }
  final int? missingNum = jsonConvert.convert<int>(json['missingNum']);
  if (missingNum != null) {
    onDutyEntity.missingNum = missingNum;
  }
  final int? normalNum = jsonConvert.convert<int>(json['normalNum']);
  if (normalNum != null) {
    onDutyEntity.normalNum = normalNum;
  }
  final int? planUnDuty = jsonConvert.convert<int>(json['planUnDuty']);
  if (planUnDuty != null) {
    onDutyEntity.planUnDuty = planUnDuty;
  }
  final int? unDuty = jsonConvert.convert<int>(json['unDuty']);
  if (unDuty != null) {
    onDutyEntity.unDuty = unDuty;
  }
  return onDutyEntity;
}

Map<String, dynamic> $OnDutyEntityToJson(OnDutyEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['askForLeave'] = entity.askForLeave;
  data['beLate'] = entity.beLate;
  data['leaveEarly'] = entity.leaveEarly;
  data['missingNum'] = entity.missingNum;
  data['normalNum'] = entity.normalNum;
  data['planUnDuty'] = entity.planUnDuty;
  data['unDuty'] = entity.unDuty;
  return data;
}

extension OnDutyEntityExtension on OnDutyEntity {
  OnDutyEntity copyWith({
    int? askForLeave,
    int? beLate,
    int? leaveEarly,
    int? missingNum,
    int? normalNum,
    int? planUnDuty,
    int? unDuty,
  }) {
    return OnDutyEntity()
      ..askForLeave = askForLeave ?? this.askForLeave
      ..beLate = beLate ?? this.beLate
      ..leaveEarly = leaveEarly ?? this.leaveEarly
      ..missingNum = missingNum ?? this.missingNum
      ..normalNum = normalNum ?? this.normalNum
      ..planUnDuty = planUnDuty ?? this.planUnDuty
      ..unDuty = unDuty ?? this.unDuty;
  }
}
